#ifndef _OPENGLAPPFRAMEWORK_SCENE_H_
#define _OPENGLAPPFRAMEWORK_SCENE_H_

#include "OpenglAppFramework/inc/GameObject.h"
#include "OpenglAppFramework/inc/OpenglEnv.h"
#include <map>
#include <string>

using GameObjects = std::map<std::string, GameObject*>;

class Shader;
class Scene {
public:
    Scene();
    ~Scene();
    
    void setGameObject(GameObject* obj);
    GameObjects& objects();
    OpenglEnv& env();

    // 没找到返回nullptr
    GameObject* getObjectByName(const std::string& name);
    GameObjects& cameraObjects();
    GameObjects& lightSourceObjects();
    GameObjects& shadowLightObjects();
    GameObjects& normalObjects();
    GameObjects& instancingObjects();

    bool hasInstancing() const;
    
private:
    OpenglEnv m_env;
    GameObjects m_objs;                 // 所有物体
    GameObjects m_camera_objs;          // 所以照相机
    GameObjects m_light_source;         // 包含光源的物体
    GameObjects m_shadow_lights;        // 需要计算阴影的光源
    GameObjects m_normal_objs;          // 正常渲染的物体
    GameObjects m_instancing_objs;      // 通过实例化渲染的物体
};

#endif//_OPENGLAPPFRAMEWORK_SCENE_H_
